package edu.ucsc.gameAI.conditions;

import pacman.game.Constants.DM;
import pacman.game.Constants.GHOST;
import pacman.game.Game;
import edu.ucsc.gameAI.ICondition;

public class DangerousGhostNearby implements ICondition {

	private final double dangerDistance = 40;

	@Override
	public boolean test(Game game) {

		int pacmanNode = game.getPacmanCurrentNodeIndex();

		for (GHOST ghost : GHOST.values()) {
			if (game.getGhostLairTime(ghost) <= 0) {
				if (game.getShortestPathDistance(pacmanNode,
						game.getGhostCurrentNodeIndex(ghost)) <= dangerDistance) {
					return true;
				}
			}

		}
		return false;
	}

}
